/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pessoas.log;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import javax.swing.JOptionPane;
import pessoas.interfaces.ILog;

/**
 *
 * @author Bush
 */
public class LogTxt implements ILog {

    private File arquivoLog;

    public LogTxt() {
        
        arquivoLog = new File("src/pessoas/data/logs.txt");
    }
        
    @Override
    public void gravarLog(String log) {
        FileWriter w;
        try {
            w = new FileWriter(arquivoLog, true);
            BufferedWriter bf = new BufferedWriter(w);
            bf.write(log);
            bf.newLine();
            bf.close();
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
    }   
   
}
